#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:6031)

#include <stdio.h>
#include <stddef.h>

#define OFFSET(type, member) ((int)&(((type*)(0))->member))

struct Student
{
	char name[10];
	int age;
	char sex;
};

int main()
{
	printf("%d\n", offsetof(struct Student, name));
	printf("%d\n", offsetof(struct Student, age));
	printf("%d\n", offsetof(struct Student, sex));

	printf("%d\n", OFFSET(struct Student, name));
	printf("%d\n", OFFSET(struct Student, age));
	printf("%d\n", OFFSET(struct Student, sex));


	//printf("%d\n", (int)&carl);
	//printf("%p\n", carl.name);
	//printf("%p\n", &carl);
	////printf("%p\n", &struct Student);
	////printf("%d", (int)(int*)123);
	//int a = (int)&(((struct Student*)0x0)->age);
	//printf("%d\n", a);
	//printf("%p\n", &(((struct Student*)0x0)->age));


	return 0;
}